<template>
    <div>
        <ul>
            <li v-for="item in btn" @click="changeurl(item.path)">{{ item.name }}</li>
        </ul>
    </div>
</template>

<script>
export default {
    data() {
        return {
            btn: [{
                id: 1,
                name: '首页',
                path: '/index'
            }, {
                id: 2,
                name: '用户信息',
                path: '/information'
            }, {
                id: 3,
                name: '个人中心'
            }, {
                id: 4,
                name: '关于'
            }]
        }
    },
    methods: {
        changeurl(path) {
            if(this.$store.state.loginstate==1){
                this.$router.push(path);
            }else{
                this.$router.push('/login');
            }
        }
    }
}
</script>

<style scoped lang="scss">
ul {
    li {
        line-height: 100px;
        text-align: center;
        font-size: 30px;
        &:hover{
            color: orange;
        }
    }
}
</style>